##<code> and </code> are detected only in the form [whitespace]<xxx>, ie at begin of line,
"""
copyright (c) 2009 Claudio Canepa
this code licensed under the new BSD license, see file license_simpledocu.txt
"""
##discarding indentation
##
##line = raw_line.expandtabs(get_tabsize())
##
##
### from idle ; por codigo que viene despues la tabulacion ya fue expandida a spaces
##getspacesfirstword =\
##                   lambda s, c=re.compile(r"^(\s*)(\w*)"): c.match(s).groups()
##num_lead_spaces = lambda s, c=re.compile(r"^(\s*)(\s)"): c.match(s).end()
##
##group initial (spaces , tabs) to get indentation level and or
##    blankline detection
##
##outs = indentation level, striped_line # indentation level = None if blankline
##
##get_line

## <code> deberia admitir el param tabsize= y quizas
## indent_delta= en chars o levels
## <code> es mas especifico que <pre> , quizas deberiamos usar <pre>

##tags:
##tags must be the only element in a line, except por leading whitespace,
##    trailing whitespace, trailing comment
##tags cannot span multiple lines



# asumes tab expansion was done
num_lead_spaces = lambda s, c=re.compile(r"^(\s*)(\s)"): c.match(s).end()


#modes = normal, into_tag, into_pre
cur_section = 
for raw_line in f.readline:
    # uniformize: linex always ends with \n and have at least 1 leading space
    #? do here some cleanup, like '\r' ?
    linex = ' '+raw_line.expand_tabs(tabsize())
    if linex[-1]!='\n':
        linex += '\n'
        
    # ignore lines begining with comment chars
    if linex[1] in comment_chars():
        continue

    indent = num_lead_spaces(linex)
    first = linex[indent]
##    cases :
##        \n -> blankline -> paragraph break ?
##        * -> list item
##        + -> indexed list item -> if unsuported we can go more stateles
##        comment_char -> ignore line
##        < -> maybe openening tag , ex: <pre...>
                                

